<template>
	<view class="page">
		<u-navbar title="投稿须知" :auto-back="true">
			<view class="u-nav-slot" slot="right">
				<view class="nav-right" @click="openPopUp">
					<u-icon name="search" size="24" color="#376CB4"></u-icon>
					<u-icon name="list" size="24" style="margin-left: 20rpx;" color="#376CB4"></u-icon>
				</view>
			</view>
		</u-navbar>
		<view class="ll"></view>
		<view class="tg-box">
			<view class="search-empty" v-if="rst.length <= 0">
				<image src="../../static/kong.png" class="empty-img"></image>
			</view>
			<view class="box-item" v-for="(item,index) in rst" @click="gotoDetail(item)" :key="index">
				<view class="box-item-left font-28">{{item.title}}</view>
				<view class="box-item-right font-24">{{item.addtime}}</view>
			</view>
		</view>
		<CommonTk  ref="commonTk"></CommonTk>
		<Footer></Footer>
	</view>
</template>

<script>
	import CommonTk from '@/components/CommonTk.vue'
	import Footer from '@/components/Footer.vue'
	import {
		api,
		apiBaseUrl,
		http
	} from '@/config/common.js'
	export default {
		data() {
			return {
				page: 1,
				total_page: 1,
				rst: []
			}
		},
		components: {
			Footer,
			CommonTk
		},
		filters: {},
		mounted() {},
		onLoad(e) {
			this.getQkDt()
		},
		onShow() {},
		beforeDestroy() {},
		onPageScroll(e) {},
		onReachBottom() {
			if (this.page < this.total_page) {
				this.page = this.page + 1
				this.getQkDt()
			} else {
				console.log('no more')
			}
		},
		methods: {
			openPopUp() {
				this.$refs.commonTk.openShow()
			},
			getQkDt() {
				api.post('api/index/columns', {
					id: 29,
					page: this.page,
					pageSize: 15
				}).then(res => {
					let rst = res.data
					if (rst.code == 1) {
						let result = rst.data
						this.total_page = result.last_page
						let temp_rst = result.data; 
						this.rst = this.rst.concat(temp_rst)
					}
				}).catch(err => {})
			},
			gotoDetail(item) {
				uni.navigateTo({
					// url: '/pages/journal_dynamics/detail',
					url: '/pages/journal_introduction/detail?id=' + item.id+'&title=投稿须知'
				})
			}
		}
	};
</script>

<style scoped>
	.box-item {
		height: 90rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid #E5E5E5;
	}

	.tg-box {
		width: 690rpx;
		margin: 0 auto;
	}

	.ll {
		height: 100rpx;
	}

	::v-deep .u-navbar__content {
		width: 750rpx;
		height: 88rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 2rpx 14rpx 0rpx rgba(4, 0, 0, 0.14);
	}

	.nav-right {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.logo {
		width: 306rpx !important;
		height: 55rpx !important;
	}

	page {
		background-color: #fff;
	}
</style>